/*
 * JosephusGame.h
 *
 *  Created on: Oct 1, 2010
 *      Author: Jacob
 */

#ifndef JOSEPHUSGAME_H_
#define JOSEPHUSGAME_H_
#include "LinkedList.h"
#include <sstream>
using std::string;
using std::ostringstream;
using std::stringstream;

//Remove me
#include <iostream>
using namespace std;

class JosephusGame
{
public:
	static JosephusGame* newGameWithNumberOfPeopleAndN(int numberOfPeople, int nthPersonToKill);
	void play();
	virtual ~JosephusGame();
private:
	int numberOfPeople;
	int prisonersRemovedInRound;
	int nthPersonToKill;
	bool soleSurvivor;
	Node* lastCurrent;
	LinkedList* prisoners;
	void validateInput();
	void createLinkedList();
	void takeTurn();
	void killEveryNthPerson();
	void removeDeadPrisoners();
	JosephusGame();
	JosephusGame(int numberOfPeople, int nthPersonToKill);
};

#endif /* JOSEPHUSGAME_H_ */
